<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>书架管理</title>
    <meta name="decorator" content="default"/>
    <%@include file="/WEB-INF/views/include/treetable.jsp" %>
    <script>
        $(function(){
            $("#treeTable").treeTable({expandLevel : 2});
        });
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="${ctx}/shelf/bkShelf/">书架列表</a></li>
</ul>
<form:form id="searchForm" modelAttribute="bkShelf" action="${ctx}/shelf/bkShelf/" method="post" class="breadcrumb form-search">
    <ul class="ul-form">
        <li><label>书架：</label>
            <form:input path="name" htmlEscape="false" maxlength="255" class="input-medium"/>
        </li>
        <li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
        <li class="clearfix"></li>
    </ul>
</form:form>
<sys:message content="${message}"/>
<table id="treeTable" class="table table-striped table-bordered table-condensed">
    <thead>
    <tr>
        <th>书库/书架</th>
        <th>更新时间</th>
        <th>备注信息</th>
        <shiro:hasPermission name="shelf:bkShelf:edit"><th>操作</th></shiro:hasPermission>
    </tr>
    </thead>
    <tbody>
    <c:forEach items="${list}" var="row">
        <tr id="${row.id}" pId="${row.parentId}">
            <td>
                <a href="${ctx}/shelf/bkShelf/form?id=${row.id}">
                        ${row.name}
                </a>
            </td>
            <td>
                <fmt:formatDate value="${row.updateDate}" pattern="yyyy-MM-dd"/>
            </td>
            <td>
                    ${row.remarks}
            </td>
            <shiro:hasPermission name="shelf:bkShelf:edit">
                <td>
                    <a href="${ctx}/shelf/bkShelf/form?id=${row.id}">修改</a>
                    <c:if test="${row.parentId != '0'}">
                        <a href="${ctx}/shelf/bkShelf/delete?id=${row.id}"
                           onclick="return confirmx('确认要删除书架吗？', this.href)">删除</a>
                    </c:if>
                    <c:if test="${row.parentId == '0'}">
                        <a href="${ctx}/shelf/bkShelf/form?parent.id=${row.id}">添加书架</a>
                    </c:if>
                </td>
            </shiro:hasPermission>
        </tr>
    </c:forEach>
    </tbody>
</table>
</body>
</html>